package org.ax.service.device.imple;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.ax.mapper.device.DeviceTypeMapper;
import org.ax.pojo.device.DeviceType;
import org.ax.service.device.DeviceTypeService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 编程人:赵浩鑫
 * 时间:2021-02-28-23:00
 */
@Service
public class IDeviceTypeService extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
    @Override
    public Page<DeviceType> searchDeviceTypes(Page page) {
        return getBaseMapper().selectPage(page, null);
    }

    @Override
    public List<DeviceType> findDeviceTypeList() {
        return getBaseMapper().selectList(null);
    }

    @Override
    public boolean addDeviceType(DeviceType deviceType) {
        return getBaseMapper().insert(deviceType)>0;
    }

    @Override
    public boolean updateDeviceType(DeviceType deviceType) {
        return getBaseMapper().updateById(deviceType)>0;
    }

    @Override
    public boolean deletesDeviceType(String[] ids) {
        return getBaseMapper().deleteBatchIds(Arrays.asList(ids))>0;
    }

    @Override
    public DeviceType toDeviceTypeId(String deviceTypeId) {
        return getBaseMapper().selectById(deviceTypeId);
    }
}
